const app = getApp()
const promisify = require("../../utils/promisify")

Page({
  data: {
    organizationImg: "",
    organizationName: "",
    activities: [],
    brief: "",
    organizationId: undefined
  },
  onLoad: function (data) {
    let that = this
    console.log("id: " + data.id)
    that.setData({
      organizationId: data.id
    })
    promisify(wx.request)({
      url:  `https://www.lional.club:6001/organization/` + data.id + `.json`,
      method: "GET",
      header: {
        'content-type': 'application/json' // 默认值
      }
    }).then(
      data => {
        data = data.data
        data.activities = data.activities.reverse()
        that.setData({
          organizationId: data.organizationId,
          organizationImg: data.organizationImg,
          organizationName: data.organizationName,
          activities: data.activities,
          brief: data.brief
        })
      }
    )
  }
})